package com.flow.dao.impl;

import java.util.ArrayList;
import java.util.List;
import com.flow.dao.IRoleTabDao;
import com.flow.model.PagerModel;
import com.flow.model.RoleTab;

/**
 * 角色Dao实现类 
 * @author Wang
 * @param <T>
 */
public class RoleTabDao<T> extends BaseDao<T> implements IRoleTabDao<T>{

	@Override
	public boolean insertRoleTab(RoleTab roleTab) {

		try {

			insert(roleTab);
			return true;

		} catch (Exception e) {

			e.printStackTrace();

		}

		return false;
	}

	@Override
	public boolean updateRoleTab(RoleTab roleTab) {
		
		try {

			update(roleTab);
			return true;

		} catch (Exception e) {

			e.printStackTrace();

		}
		
		return false;
	}

	@Override
	public boolean deleteRoleTab(RoleTab roleTab) {
		
		try {

			delete(roleTab);
			return true;

		} catch (Exception e) {

			e.printStackTrace();

		}
		
		return false;
	}

	@Override
	public RoleTab findRoleTabByHql(String hql) {

		return findRoleTabByHql(hql, null);
		
	}

	@Override
	public RoleTab findRoleTabByHql(String hql, Object param) {

		List<Object> params  = new ArrayList<Object>();
		params.add(param);
		return findRoleTabByHql(hql, params);
		
	}

	@Override
	public RoleTab findRoleTabByHql(String hql, List<Object> params) {
		
		return (RoleTab) findByHql(hql, params);
		
	}

	@Override
	public int universalMethodRoleTab(String hql) {

		return universalMethodRoleTab(hql, null);
		
	}

	@Override
	public int universalMethodRoleTab(String hql, Object param) {

		List<Object> params  = new ArrayList<Object>();
		params.add(param);
		return universalMethodRoleTab(hql, params);
		
	}

	@Override
	public int universalMethodRoleTab(String hql, List<Object> params) {

		return universalMethod(hql, params);
		
	}

	@Override
	public List<T> findRoleTabAllByHql(String hql) {

		return findRoleTabAllByHql(hql, null);
		
	}

	@Override
	public List<T> findRoleTabAllByHql(String hql, Object param) {

		List<Object> params  = new ArrayList<Object>();
		params.add(param);
		return findRoleTabAllByHql(hql, params);
		
	}

	@Override
	public List<T> findRoleTabAllByHql(String hql, List<Object> params) {

		return findAllByHql(hql, params);
		
	}

	@Override
	public PagerModel findRoleTabPagerModeled(PagerModel pager,
			String hql) {
		
		return findRoleTabPagerModeled(pager, hql, null);
		
	}

	@Override
	public PagerModel findRoleTabPagerModeled(PagerModel pager, String hql, Object param) {
		
		List<Object> params  = new ArrayList<Object>();
		params.add(param);
		return findRoleTabPagerModeled(pager, hql, params);
		
	}

	@Override
	public PagerModel findRoleTabPagerModeled(PagerModel pager, String hql, List<Object> params) {

		return findPagerModeled(pager, hql, params);
		
	}

}
